import SimpleXMLRPCServer

class xmlrpcfeedserver:
  def getCategories(self):
    return "deportes,politica,cine,computacion"
  def getNewsByNumber(self, newsid):
    return {"newsid":"543543","title":"a news","description":"a description\nlalala","date":"a date","url":"link","tag":"cine,politica"}
  def getNews(self, page=0, count=10):
    return [{"newsid":"3333","title":"zararaza","tags":"politica,deporte"},{"newsid":"4444","title":"lalalala","tags":"politica"}]
  def assignCategory(self, number, catrgories):
    return 1
  def getFeeds(self,page=0, count=10):
    return [{"title":"feed1","feedid":1234},{"title":"feed2","feedid":"5678"}]
  def getFeedByNumber(self, feedid):
    return {"title":"feed1","feedid":"1234","url":"url1","date":"a date"}
  def addFeed(self, feedurl):
    if(feedurl == "lalala" ):
      return 1
    else:
      return 0
  def delFeed(self, feedid):    
    return feedid
  def Search(self, intag, outtag,page,count):
    return [{"newsid":"3333","title":"mmmmmm","tags":"politica,deporte"},{"newsid":"4444","title":"sssss","tags":"kdkdkd"}]

if __name__ == "__main__":
  feedserver = xmlrpcfeedserver()
  server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888))
  server.register_instance(feedserver)
  print "escuchando en el puerto 8888"
  server.serve_forever()